#ifndef SROS_DEVICE_IMPL_HPP
#define SROS_DEVICE_IMPL_HPP

#include <commons/type/ret.hpp>
#include <commons/config/config.hpp>

namespace sros::device
{
    const std::string MODULE = "device";
    const std::string NODE = "PeriphDevices";
    class device_base
    {
    public:
        device_base() = default;

        virtual ~device_base() = default;

        virtual RetBool init() = 0;

        virtual void run() = 0;

        virtual void close() = 0;
    };

    template <typename T>
    class device_impl : public device_base
    {
    public:
        device_impl() = default;
        virtual ~device_impl() = default;

        std::shared_ptr<commons::Config<T>> cfg_ptr() { return config_; }
    
    protected:
        virtual RetBool load_config() = 0;
        
    protected:
        std::shared_ptr<commons::Config<T>> config_ = nullptr;
    };
}
#endif